﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace Antu.Business.Others
{
    public class ScriptClass
    {
        //脚本操作的类

        #region  //弹出提示信息
        /// <summary>
        /// 弹出操作提示信息 2007-2-5陈东海
        /// </summary>
        /// <param name="page"></param>
        /// <param name="strMsg">弹出提示信息框</param>
        /// <param name="formid">第几个表单</param>
        public static void ConfrimOperation(Page page)
        {
            StringBuilder sbScript = new StringBuilder();

            sbScript.Append("<script language=javascript>");
            sbScript.Append("function Confrim(strmsg,formaId)");
            sbScript.Append("{");
            sbScript.Append("  var Elements = document.forms[formaId].elements;");
            sbScript.Append("  var SelectedNumber = 0;");
            sbScript.Append("  ");
            sbScript.Append("    for( var i=0;i<Elements.length;i++)");
            sbScript.Append("    {");
            sbScript.Append("        if(Elements[i].type=='checkbox' && Elements[i].checked)");
            sbScript.Append("        {");
            sbScript.Append("            SelectedNumber = SelectedNumber + 1;");
            sbScript.Append("         }");
            sbScript.Append("     }");

            sbScript.Append("    if(SelectedNumber==0)");
            sbScript.Append("    {");
            sbScript.Append("       alert('没有要'+strmsg+',请选择!');");
            sbScript.Append("       return false;");
            sbScript.Append("     }");
            sbScript.Append("     else");
            sbScript.Append("     {");
            sbScript.Append("        return window.confirm('确认要'+strmsg+eval(SelectedNumber)+'个');");
            sbScript.Append("      }");
            sbScript.Append("}");
            sbScript.Append("</script>");

            page.ClientScript.RegisterClientScriptBlock(page.GetType(), "redirect", sbScript.ToString());

        }
        #endregion

        #region //打开模式窗口
        /// <summary>
        /// 2007-2-8 陈东海
        /// </summary>
        /// <param name="page"></param>
        public static void OpenShowModile(Page page)
        {
        }
        #endregion
    }
}
